package com.rajeshDyadav.spring.ioc.example01;

import java.util.Calendar;

public class HelloBean {
    Name name;
    public ServiceHello hello;
    public ServiceBye bye;
    
    public void setServiceHello(ServiceHello serviceHello) {
	this.hello = serviceHello;
    }
    
    public void setServiceBye(ServiceBye serviceBye) {
	this.bye = serviceBye;
    }
    
    public void setName(Name name) {
	this.name = name;
    }
    
    public Name getName() {
	return name;
    }
    
    public String wishMe(Name name) {
	Calendar calendar = Calendar.getInstance();
	
	if (calendar.get(Calendar.HOUR_OF_DAY) < 12) {
	    return hello.sayHello(name); 
	} else {
	    return bye.sayBye(name);
	}
    }    
}
